package pf.springBoot.springBootSSO.dal;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
//
//import com.perfect.demo.configuration.Jdbc;

import pf.java.pfHelperNotSpring.ISqlExecute;
//import pf.java.pfHelper.PFSqlConn;
import pf.java.pfHelperNotSpring.PFSqlExecute;
import pf.java.pfHelper.config.PFDataHelper;
import pf.springBoot.springBootSSO.configuration.jdbc.*;

@Configuration
public class AccessBase {
    @Autowired
    private YJQueryJdbc yjQueryJdbc;
    @Autowired
    private BalanceJdbc balanceJdbc;
    @Autowired
    private DayJdbc dayJdbc;
    
    public String SqlString ;

    public  ISqlExecute GetSqlExec() throws Exception {
    	//return new PFSqlConn(yjQueryJdbc);
    	return PFSqlExecute.Init(yjQueryJdbc);
    	}
    public  ISqlExecute GetYJQuerySqlExec() throws Exception {
    	//return new PFSqlConn(yjQueryJdbc);
    	return PFSqlExecute.Init(yjQueryJdbc);
    	}

//    public String BDDataConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["bddata"].ConnectionString;
//        }
//    }
//
//    public String NewshopConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["newshop"].ConnectionString;
//        }
//    }
//    public String FgsDataConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["fgsdata"].ConnectionString;
//        }
//    }
//
//    public String FafangConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["fafang"].ConnectionString;
//        }
//    }
//    public String BonusConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["bonus"].ConnectionString;
//        }
//    }
//
//    public String YJQueryConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["YJQuery"].ConnectionString;
//        }
//    }
//
//    public String PerMallConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["mallConnection"].ConnectionString;
//        }
//    }
//    public String HyzlConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["hyzlConnection"].ConnectionString;
//        }
//    }
//    public String XShopNewConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["xShopNew"].ConnectionString;
//        }
//    }
    public ISqlExecute GetBalanceSqlConn() throws Exception
    {
            return  PFSqlExecute.Init(balanceJdbc);
    }
//    public String GetBalanceConnectionString()
//    {
//            return ConfigurationManager.ConnectionStrings["balance"].ConnectionString;
//    }
//    public String ReportConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["dbreportConn"].ConnectionString;
//        }
//    }
//    public String MessageServerConnectionString//发送手机短信
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["messageServer"].ConnectionString;
//        }
//    }
//    public String MessageServerTestConnectionString//发送手机短信test//待删除
//    {
//        get
//        {
//            return Perfect.PFDataHelper.IsDebug ? ConfigurationManager.ConnectionStrings["messageServerTest"].ConnectionString
//                : MessageServerConnectionString;
//            //return ConfigurationManager.ConnectionStrings["messageServerTest"].ConnectionString;
//        }
//    }
//    public String AmsConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["NewAMS"].ConnectionString;
//        }
//    }
//    public String UnicomDstConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomDstConnection"].ConnectionString;
//        }
//    }
    public ISqlExecute GetDaySqlConn() throws Exception
    {
            return PFSqlExecute.Init(dayJdbc);
    }
//    public String DayConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["dayConnection"].ConnectionString;
//        }
//    }
//
//    public String UnicomHyzlConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomHyzlConnection"].ConnectionString;
//        }
//    }
//    public String UnicomAgentConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomAgentConnection"].ConnectionString;
//        }
//    }
//    public String UnicomBaseDataConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomBaseDataConnection"].ConnectionString;
//        }
//    }
//    public String UnicomInvConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomInvConnection"].ConnectionString;
//        }
//    }
//    public String UnicomTradeConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomTradeConnection"].ConnectionString;
//        }
//    }
//    public String UnicomIscmConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomIscmConnection"].ConnectionString;
//        }
//    }
//    public String UnicomMemberConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomMemberConnection"].ConnectionString;
//        }
//    }
//    public String UnicomPromotionConnectionString
//    {
//        get
//        {
//            return ConfigurationManager.ConnectionStrings["unicomPromotionConnection"].ConnectionString;
//        }
//    }

    public String GetYJQueryDataBase(String month)
    {
    	ISqlExecute sqlexec;
		try {
			sqlexec = PFSqlExecute.Init(yjQueryJdbc);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "";
		}
        SqlString =PFDataHelper.FormatString("SELECT databasename FROM databasetable where cmonth='{0}' ", month);
        return sqlexec.QuerySingleValue(SqlString).toString();
    }
}
